package com.qrcode.QRCode;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import jp.sourceforge.qrcode.QRCodeDecoder;

public class ReadQRcode {

	public static void main(String[] args) {
		File file = new File("E:/qrcode.png");
		try {
			//读取二维码文件
			BufferedImage bufferedImage = ImageIO.read(file);
			QRCodeDecoder codeDecoder = new QRCodeDecoder();
			//解析二维码
			String result = new String(codeDecoder.decode(new MyQRcodeImage(bufferedImage)),"UTF-8");
			System.out.println(result);
		} catch (IOException e) {
			e.printStackTrace();
		}	
	}

}
